#include <bits/stdc++.h>
#ifndef DEBUG
#define debug
#endif
using namespace std;
using i64 = int64_t;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> g(n + 1);
  while (m --) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<vector<bitset<501>>> dp(k + 1, vector<bitset<501>>(n + 1));
  for (int i = 1; i <= n; i ++) {
    dp[0][i][i] = 1;
  }
  for (int i = 1; i <= k; i ++) {
    for (int j = 1; j <= n; j ++) {
      for (int u : g[j]) {
        dp[i][j] |= dp[i - 1][u];
      }
    }
  }
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= k; j ++) {
      cout << dp[j][i].count() << ' ';
    }
    cout << endl;
  }
}